package top.continew.admin.common.userContext;

/**
 * @program: examstarapi
 * @description: 用户拦截的上下文
 * @author: Xiong weiqiang
 * @create: 2025-05-27 16:22
 */
public class DistributeUserContextLoader {
    // 用户上下文有InheritableThreadLocal，可以继承。
    private static InheritableThreadLocal<UserDistributeContext> userContext = new InheritableThreadLocal<>();

    public static void setUserContext(UserDistributeContext userContext) {
        DistributeUserContextLoader.userContext.set(userContext);
    }

    public static UserDistributeContext getUserContext() {
        return userContext.get();
    }
}